package tangmukeji.com.rxjava2retrofit2.api;

import java.util.List;

import io.reactivex.Observable;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.http.Field;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.Query;
import retrofit2.http.Url;
import tangmukeji.com.rxjava2retrofit2.base.BaseBean;
import tangmukeji.com.rxjava2retrofit2.base.Subject;

/**
 * Created by Administrator on 2018/4/4.
 */

public interface ApiService {

    @POST("shopping_login.htm")
    Observable<String> LoginByRx(@Field("username") String username, @Field("password") String password);

    @Multipart
    @POST("user/register.do")
    Observable<String> register(@Part("phone") RequestBody phone, @Part("password") RequestBody password, @Part MultipartBody.Part image);

    //    @Streaming
    @GET
    /**
     * 大文件官方建议用 @Streaming 来进行注解，不然会出现IO异常，小文件可以忽略不注入
     */
    Observable<ResponseBody> downloadFile(@Url String fileUrl);

    //
    @GET("top250")
    Observable<BaseBean<List<Subject>>> getMovie(@Query("start") int start, @Query("count") int count);
}
